package com.example.mapp;

import com.example.entity.ElevatorArchives;
import org.apache.ibatis.annotations.*;

/**
 * Created by youkun on 2017/9/22.
 */
@Mapper
public interface ElevatorArchivesMapp {

    @Select(" select * from elevator_archives  where used_party_id=#{id}")
    ElevatorArchives queryById(String id) throws Exception;

    @Delete("delete from elevator_archives where used_party_id=#{id}")
    int deleteById(String id)throws Exception;

    @Insert("insert into elevator_archives " +
            "(used_party_id,project_name,contract_num,used_org_name," +
            "used_org_address,elevator_org_address,register_id,registration_card," +
            "cantacts,phonenum,fax,conformity_certificate,sales_installation_contract," +
            "installation_notification,inspection_requisition,self_check_record,supervision_apply," +
            "acceptance_report,completion_documents,installation_acceptance_record,site_problem_report," +
            "construction_design_scheme,safety_technical_disclosure,unpacking_record,safety_components_test_report," +
            "annual_inspection_report,routine_maintenance,elevator_maintenance_contract,remarks,person_shouze,person_rcgl_ryzz," +
            "jsrczgz,jcwhczgz,cgjczd,whbyzd,dqbjzd,pxkhzd,ywyjyxzd,dtaqglzd,ysglzd,sbfbt,dtztz,wbjhb,zyryda,wbryda,dxgzjdbj,ndqjybj) " +
            " value " +
            "(#{usedPartyId},#{projectName},#{contractNum},#{usedOrgName},#{usedOrgAddress},#{elevatorOrgAddress}," +
            "#{registerId},#{registrationCard},#{cantacts},#{phoneNUm},#{fax},#{conformityCertificate},#{salesInstallationContract}," +
            "#{installationNotification},#{inspectionRequisition},#{selfCheckRecord},#{supervisionApply},#{acceptanceReport}," +
            "#{completionDocuments}," +
            "#{installationAcceptanceRecord},#{siteProblemReport},#{constructionDesignScheme},#{safetyTechnicalDisclosure},#{unpackingRecord}," +
            "#{safetyComponentsTestReport},#{annualInspectionReport},#{routineMaintenance},#{elevatorMaintenanceContract},#{remarks}," +
            "#{personShouze}," +
            "#{personRcglRyzz},#{jsrczgz},#{jcwhczgz},#{cgjczd},#{whbyzd},#{dqbjzd},#{pxkhzd},#{ywyjyxzd},#{dtaqglzd},#{ysglzd},#{sbfbt}," +
            "#{dtztz},#{wbjhb}," +
            "#{zyryda},#{wbryda},#{dxgzjdbj},#{ndqjybj})")
    @SelectKey(statement="select last_insert_id()",keyProperty = "id",keyColumn = "id",before = false,resultType = Long.class)
    int add(ElevatorArchives elevatorArchives) throws Exception;

    @Update("update elevator_archives set used_party_id=#{usedPartyId} where id=#{id}")
    int update(ElevatorArchives elevatorArchives) throws Exception;
}
